Technotes


Forcing Floppy Disk Size to be Either 400K or 800K



Technote DV 07February 1986



Revised by: March 1988
Written by: Rick Blair February 1986

This document explains how to initialize a disk as either single- or double- sided. It only applies to 800K drives, of course.

You can call the disk driver to initialize a disk and determine programmatically whether it should be initialized as single- (MFS) or double- (HFS) sided. All you have to do is call the .Sony driver directly to do the formatting then the Disk Initialization Package to write the directory information.

Note: This is not the way you should normally format disks within an application. If the user puts in an unformatted disk, you should let her or him decide whether it becomes single- or double-sided via the Disk Initialization dialog. This automatically happens when you call DIBadMount or the user inserts a disk while in Standard File. The intent of this technical note is to provide a means for specific applications to produce, say, 400K disks. An example might be a production disk copying program.


From MPW Pascal:

	VAR
	  error:      OSErr;
	  IPtr:       ^INTEGER;
	  paramBlock: ParamBlockRec; 	{needs OSIntf}
	...
	WITH paramBlock DO BEGIN
	   ioRefNum := -5;			{.Sony driver}
	   ioVRefNum := 1;			{drive number}
	   csCode := 6;			{format control code}
	   IPtr:=@csParam;			{pretend it's an INTEGER}
	   IPtr^:=1;				{number of sides}
	END;
	error:=PBControl(@paramBlock, FALSE);	{do the call}
	IF error=ControlErr THEN

	{you are under MFS, which doesn't support control code 6, but it}
	{would always get formatted single-sided anyway.}
	{other errors are possible: ioErr, etc.}

	END;
From MPW C:
	OSErr			error;
	CntrlParam		paramBlock; 
	

	paramBlock.ioCRefNum = -5;	/*.Sony driver*/
	paramBlock.ioVRefNum = 1;	/*drive number*/
	paramBlock.csCode = 6;	/*format control code*/
	paramBlock.csParam[0]=1;     /*for single sided,2 for double-sided*/


	error=PBControl(&paramBlock, false);/*do the call*/
	if (error==controlErr) ;
	/*you are under MFS, which doesn't support control code 6, but it*/
	/*would always get formatted single-sided anyway.*/
	/*other errors are possible: ioErr, etc.*/

You then call DIZero to write a standard (MFS or HFS) directory. It will produce MFS if you formatted it single-sided, and HFS if you formatted double-sided.

Further Reference:




Technotes
Previous Technote | Contents | Next Technote